package com.example.yzj16478026;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    private Button btn_reg,btn_log;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //初始化绑定
        initBind();
        //为各个按钮绑定点击事件
        bindEvent();
    }

    private void bindEvent() {
        btn_log.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,LoginActivity.class);
//                System.out.println("greg");
//                intent.setClassName(getPackageName(),"LoginActivity");
                startActivity(intent);

            }
        });
        btn_reg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent();
                intent.setClass(MainActivity.this,activity_register.class);
                startActivity(intent);
            }
        });
    }

    private void initBind() {
        btn_log=findViewById(R.id.btn_log);
        btn_reg=findViewById(R.id.btn_reg);
    }

}
